home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / gpg < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.3 KB  |  49 lines

  1. # bash completion for gpg
  2.  
  3. have gpg &&
  4. _gpg()
  5. {
  6.     local cur prev
  7.  
  8.     COMPREPLY=()
  9.     _get_comp_words_by_ref cur prev
  10.  
  11.     case $prev in
  12.         -s|--sign|--clearsign|--decrypt-files|--load-extension)
  13.             _filedir
  14.             return 0
  15.             ;;
  16.         --export|--sign-key|--lsignkey|--nrsignkey|--nrlsignkey|--editkey)
  17.             # return list of public keys
  18.             COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
  19.                 sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \
  20.                     -ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
  21.             return 0
  22.             ;;
  23.         -r|--recipient)
  24.             COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
  25.                 sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
  26.             if [ -e ~/.gnupg/gpg.conf ]; then
  27.                 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne \
  28.                     's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' \
  29.                     ~/.gnupg/gpg.conf  )" -- "$cur") )
  30.             fi
  31.             return 0
  32.         ;;
  33.     esac
  34.  
  35.     if [[ "$cur" == -* ]]; then
  36.         COMPREPLY=( $( compgen -W '$(gpg --dump-options)' -- "$cur" ) )
  37.      fi
  38.  
  39. } &&
  40. complete -F _gpg -o default gpg
  41.  
  42. # Local variables:
  43. # mode: shell-script
  44. # sh-basic-offset: 4
  45. # sh-indent-comment: t
  46. # indent-tabs-mode: nil
  47. # End:
  48. # ex: ts=4 sw=4 et filetype=sh
  49.